<script>
  var str0 = "<H1>Chapter 1 <目标文字> 介绍正则表达式</H1><H1>Chapter 2 > 介绍正则表达式2</H1>";


  var str1 = "xxhgnxx Is the is  11hgn11 kkkhgnkkk cost xx皇冠鸟xx  oohgnoo 22hgn22 gasoline going up up";
  exg1 = [
    /\bxx.*xx/ig,
    /\bxx.*?xx/ig,
    /\b[a-z]{2}\b/ig,
    /(([a-z])\2).*?(\1)/g,
    // /([a-z]+).*?\1\b/ig,
    // /([a-z]+).*?\1\b/ig,
    // /\S+/ig,
    // /(xx).*(oo).*(kkk).*\1\b/ig,
    // /(xx.*?xx)|(oo.*?00)/ig,
    // /(xx).*?(oo)/ig,
    // /(xx).*?(oo).*?\2/ig,
    // /([a-z]{2}).*?([0-9]{2}).*\1/ig,
    // /([a-z]{2}).*?([0-9]{2}).*\1/ig,
    // /([a-z]{2}).*?([0-9]{2}).*\1/ig,
    // /([a-z]{2}).*?([0-9]{2}).*\2/ig,
    // /(?<Word>[a-z]{2}).*?([0-9]{2}).*\1/ig,
    // /([a-z]{2}).*?(?<Word>[0-9]{2}).*\1/ig,
    // /(?:[a-z]{2}).*?([0-9]{2}).*\1/ig,
    // /([a-z]{2}).*?(hgn).*?([0-9]{2}).*\1/ig,
    // /([a-z]{2}).*?(hgn).*?([0-9]{2}).*\2/ig,
    // /([a-z]{2}).*?(hgn).*?([0-9]{2}).*\3/ig,
    // /([a-z]{2}).*?(?<ha>hgn).*?([0-9]{2}).*\k<ha>/ig,
    // /(?:[a-z]{2}).*?(hgn).*?([0-9]{2}).*\2/ig,
  ]
  // exg_print(exg1, str1)


  var str2 = '[b class="hello"]Hello[/b][i]world[/i]'
  var exg2 = [
    /\[(\w+)([^\]]*)\](.*?)\[\/\1\]/g,
  ]
  // exg_print(exg2, str2)
  exg_print(
    [/[a-z]{2}/g],
    'cost xx皇冠鸟xx daskl;dna xx 11 22'
  )

  function exg_print(exg, str) {
    document.write(str, '<br>', '----******--------*****--------', '<br>');
      for (let i = 0; i < exg.length; i++) {
        print(exg[i])
      }


    function print(element) {
      console.log(element.exec('xxxxxxxxxxxxxxxxxxxxxxxxxxxx[b class="hello"]Hello[/b][i]world[/i]'));
      console.log(element.exec(str));
      document.write( '->  ',
        element, '<br>',
        str.match(element), '<br>', // match可以理解为执行一次完整的匹配 
        element.exec(str), '<br>', // 只执行一次
      )
    }
  }

  var k= '123aa123bb123cc'
  
  console.log(k.split(/[a-z]{2}/g));



  // document.write(str.match(patt2),'<br>');
  // document.write(str.match(patt3),'<br>');
  // document.write(str.match(patt4),'<br>');
</script>